UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7wGFVTquBjZwoFBG5oay1fl6VUifLLRriwfQ2r/crAc=' 
WHERE 
  key_id = '51f0a0a1144b25e255940b1cc5a5bbb0a4ced7aef3335ffe72573a386fc0b8e0' 
  AND (
    token = '7wGFVTquBjZwoFBG5oay1fl6VUifLLRriwfQ2r/crAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031