UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2BW8AqXfRvYKmHmaq0C/sfPnPTGPkVxwehjKDk5a1GQ=' 
WHERE 
  key_id = '338244029ebe3cba25cc3a1e08ada16f20d6f4b4367d140c806a31e8f2f38123' 
  AND (
    token = '2BW8AqXfRvYKmHmaq0C/sfPnPTGPkVxwehjKDk5a1GQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026