UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JgCEBbM3/o+DLZI2VwYmfm7DuQ1B6gwM1KhPILQEAuk=' 
WHERE 
  key_id = '84c7c75f3cc249b2d05d0a12a4a8f5572421aa54bb920b53dca7da47ea932404' 
  AND (
    token = 'JgCEBbM3/o+DLZI2VwYmfm7DuQ1B6gwM1KhPILQEAuk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034