UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PwqORcd7wBYUexglhf+xGmN68rj6ZOQgPVWlIJ8RzJs=' 
WHERE 
  key_id = '9f367e69aedaaad05261242bac2ca13c84da85e2cb3a6d8d7649777431263711' 
  AND (
    token = 'PwqORcd7wBYUexglhf+xGmN68rj6ZOQgPVWlIJ8RzJs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031