UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'REqwdnBengZXtI5jAN57E9iSdF9XEOVxnz6fPBDM+uo=' 
WHERE 
  key_id = '0918dcc25de299beb758654c76d2149aef7220ca0f7c511430e485c58aa8c0a6' 
  AND (
    token = 'REqwdnBengZXtI5jAN57E9iSdF9XEOVxnz6fPBDM+uo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041