UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OHf4X1mk+e1chJpzHKB8QD28qoxJso4n8JqzC66/hcM=' 
WHERE 
  key_id = '687f6583ea63870a0aa0cf86bab2db038bb75ddd0238b9904469d77ea868d560' 
  AND (
    token = 'OHf4X1mk+e1chJpzHKB8QD28qoxJso4n8JqzC66/hcM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039