UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N5ns474g5xxuXzfMRV8hd3xjhGMLrlB8/j5QO1HHFrw=' 
WHERE 
  key_id = '37d0ba65da1d5042dd07f044e1386a549ff6ca7e95a06a6ad9032785f324be81' 
  AND (
    token = 'N5ns474g5xxuXzfMRV8hd3xjhGMLrlB8/j5QO1HHFrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029