UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q81FsYdJ2VgxVl5GVYI98kjHfU3T8vzYQrLPFVxI/R8=' 
WHERE 
  key_id = '77a87b1285875ff841114b326a1e380c0206016ed6eb2ff02b053178026783f1' 
  AND (
    token = 'Q81FsYdJ2VgxVl5GVYI98kjHfU3T8vzYQrLPFVxI/R8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036