UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K3/g9u0m8YmjhLAWEQCS/gAiBcPvUV4LkbmGKbiVv+A=' 
WHERE 
  key_id = '34e439f0b9227b660c9cf3632a78815ee25612abd225e8ccdb7c8844b2a53a48' 
  AND (
    token = 'K3/g9u0m8YmjhLAWEQCS/gAiBcPvUV4LkbmGKbiVv+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035