UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tgK3uJJdcxBxOlXw71nUJm3Jm67RalNH3FMJ3CYFmhE=' 
WHERE 
  key_id = '351681df270951550a852e0afe32a801cd6aff0c4cff55013e1df1f9081f8c68' 
  AND (
    token = 'tgK3uJJdcxBxOlXw71nUJm3Jm67RalNH3FMJ3CYFmhE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036