UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Eh4RzyAyTN6uQOqAS/IZXofDgBW1a6LeR+P2cUIrOuI=' 
WHERE 
  key_id = '517b33f81a191c0bef2465198f1c6d03b7ef30b72a75febc6c25aba1aa23bba8' 
  AND (
    token = 'Eh4RzyAyTN6uQOqAS/IZXofDgBW1a6LeR+P2cUIrOuI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052