UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QewltkYj8vqhqzCAsE/V38mJTvAgR7DmOLnipKz5zz8=' 
WHERE 
  key_id = '13bafcb3ef1605099717e97da754f12402b18062f7f57220a3229cd7cac3736a' 
  AND (
    token = 'QewltkYj8vqhqzCAsE/V38mJTvAgR7DmOLnipKz5zz8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032