UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yisV7lqAVqRGragAKNig+kLXr6+BJ/K75kkAjq8NsoQ=' 
WHERE 
  key_id = '64790ed73c38935ea686bdd10828c262adb783371f91ee22d36bf0a569edffe8' 
  AND (
    token = 'yisV7lqAVqRGragAKNig+kLXr6+BJ/K75kkAjq8NsoQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053