UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kMpwD+bCrMv7hyXa5yNVm21EhjovqEKDq4kNoatKOZc=' 
WHERE 
  key_id = 'f961b21327f60bfea0075d0c4a97079f700f36191ee40d7cf2dcdf928b511545' 
  AND (
    token = 'kMpwD+bCrMv7hyXa5yNVm21EhjovqEKDq4kNoatKOZc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017