UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UZO+1CoOhApuQzVUDiQWmXjW3P8p+VmxDt15+1mn+1w=' 
WHERE 
  key_id = '4632b0433683181de84313e25721756c11635b65e946a6b008e1a5ef017294fc' 
  AND (
    token = 'UZO+1CoOhApuQzVUDiQWmXjW3P8p+VmxDt15+1mn+1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026