UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JuQUCS6YaLgrEoUhRE2nIC2VCx1wm7U8MNuXds2YLhU=' 
WHERE 
  key_id = '456af39b6f757f7be0e13368986729659293c628da81de8c45af8dcaf78ab58a' 
  AND (
    token = 'JuQUCS6YaLgrEoUhRE2nIC2VCx1wm7U8MNuXds2YLhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038