UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dZgbpxtbsry3u0Q3TfVbbF7cwozWAqJDdEkGW6HEMlI=' 
WHERE 
  key_id = 'eb78bbec68b9f12c9c75bae497f7c3e515a1e4f0a44cdde7fd896bb6223effe0' 
  AND (
    token = 'dZgbpxtbsry3u0Q3TfVbbF7cwozWAqJDdEkGW6HEMlI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033