UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'drolYst9b3CQfazVOzlnleGVBTfZXJj3zlZoiVmxpwY=' 
WHERE 
  key_id = 'a37b39cda58b4119adffd5b0a7c079f945d87d4aedb16720e178eed14e10f5a3' 
  AND (
    token = 'drolYst9b3CQfazVOzlnleGVBTfZXJj3zlZoiVmxpwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066