UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0iO7bPmrrImIo7Dy7r+mB6ldlfr7Bqdh2Xw+l7AqN1k=' 
WHERE 
  key_id = 'cc36dfa1c60d91753cf42c75741483a93c3dabe840cca5650047b396ee5f9416' 
  AND (
    token = '0iO7bPmrrImIo7Dy7r+mB6ldlfr7Bqdh2Xw+l7AqN1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031