UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jpiOBZw4lKiPYvfIPzyskIs4LEjqtdn+qvcrNbBtGVo=' 
WHERE 
  key_id = '20ddf8aa7792d6e4217a5b9d8e8b7eadcf3e30110482623ec842d04e29c9c5ee' 
  AND (
    token = 'jpiOBZw4lKiPYvfIPzyskIs4LEjqtdn+qvcrNbBtGVo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046