UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O+SC0jUH4My16PsrsDTTAQ0+4VUnZY4F6tlA43/dxi0=' 
WHERE 
  key_id = '531ffaa45f4f5579444defb9de350b8978b8e945282b492dfae923b951d9627f' 
  AND (
    token = 'O+SC0jUH4My16PsrsDTTAQ0+4VUnZY4F6tlA43/dxi0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039