UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GXhY02zePKa+Dfi0NDSVEu5FqPqtDJ8Lg4/LzNQtL9s=' 
WHERE 
  key_id = '6bc211e0722ae395f3a8eecde1435d7dfe6202529466a28028ab7706c4729525' 
  AND (
    token = 'GXhY02zePKa+Dfi0NDSVEu5FqPqtDJ8Lg4/LzNQtL9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036