UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zii5M09IJ5cDJhdE7IVJyCOxXcJ4Osxaj40dJbfPSas=' 
WHERE 
  key_id = '596b9eae017dedfad66b38225eb57f7aaf67e6e098ca5885a731849ac761944e' 
  AND (
    token = 'Zii5M09IJ5cDJhdE7IVJyCOxXcJ4Osxaj40dJbfPSas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040