UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GaL4eatBytLSU24aVhvn+MF9J8m3stUPYyGDqkbvlPY=' 
WHERE 
  key_id = '4deef76c8a7b2c3204557b5dc5994adf29d1bd672e4081a2d22e0a8e5a57bf85' 
  AND (
    token = 'GaL4eatBytLSU24aVhvn+MF9J8m3stUPYyGDqkbvlPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058