UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'khJqMCBY8kGEkO7ksHXdJEUvjcKqBhwHcNB8tbrMB2c=' 
WHERE 
  key_id = '976b848abf51e89b327ef3c98d5a7fbb20c6afa69441371309eab494702a2703' 
  AND (
    token = 'khJqMCBY8kGEkO7ksHXdJEUvjcKqBhwHcNB8tbrMB2c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053