UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sgWRvTpNavLc2w+JnIeUSeX7W6ayBKdb9d2I96OwOBg=' 
WHERE 
  key_id = 'efd6159d5416b9d198e705fcbe4864d7610f2c977cf90475d64a8b28356c8100' 
  AND (
    token = 'sgWRvTpNavLc2w+JnIeUSeX7W6ayBKdb9d2I96OwOBg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023