UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FnJXJ2kFVeSxERCUsLihdq3jH4IH+wJsYCBNIhrectA=' 
WHERE 
  key_id = '67608e45342b9f8886caac4f8997e7521eb1809e1bc5223a10dc09b11d323f98' 
  AND (
    token = 'FnJXJ2kFVeSxERCUsLihdq3jH4IH+wJsYCBNIhrectA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039