UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8R32/ZYqIEy68eKGvxmhMEywkv/TLH/OE46sMAniE4s=' 
WHERE 
  key_id = 'b743ee23d111633f7ad2550ab1d5876d7a5b74abf805f025195ae736c45cb94f' 
  AND (
    token = '8R32/ZYqIEy68eKGvxmhMEywkv/TLH/OE46sMAniE4s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034