UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aG/hTPYYDiLmn3a35XSXoIp4Ds5KLbX6tBF0/NDonx4=' 
WHERE 
  key_id = '56b45755d124c5e3b4ce30b53b2bbe0e74134cd29393d1c55deac358f5683924' 
  AND (
    token = 'aG/hTPYYDiLmn3a35XSXoIp4Ds5KLbX6tBF0/NDonx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030