UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D0LzPac8EQzKu2lHJdyysOZGVOGoei3fJI5L12hc4xQ=' 
WHERE 
  key_id = '3e1e734a5c92bb9999edff33094bc6c493862b737c64c732812cc25511e04768' 
  AND (
    token = 'D0LzPac8EQzKu2lHJdyysOZGVOGoei3fJI5L12hc4xQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036