UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4hWKgEER1S/5STug2EFqsrxU+jUscsUryo3BH8yb7CE=' 
WHERE 
  key_id = '51c0b18eeacea98a643ec1a35401262b6bbd247994d114d33481a09736a6ca2d' 
  AND (
    token = '4hWKgEER1S/5STug2EFqsrxU+jUscsUryo3BH8yb7CE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054