UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GM0ecg8Mk6lxnVFIQlui3nL04u6+hsaOS2DUGJzEiX8=' 
WHERE 
  key_id = '7214f7c56062d8e3136e952220d9fbb99a7f5feee551ec80307e712f5301b8fb' 
  AND (
    token = 'GM0ecg8Mk6lxnVFIQlui3nL04u6+hsaOS2DUGJzEiX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029