UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y7aqEl7HyagD+ERiy9rMqpeQOOypHoCPnmBQ++DYJ+o=' 
WHERE 
  key_id = 'de31884e89875e78a100f5231b197eedf40e4347d5ac56716a332a7b47f9250b' 
  AND (
    token = 'y7aqEl7HyagD+ERiy9rMqpeQOOypHoCPnmBQ++DYJ+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035