UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wKC6AEs5zFcgjjKl+ohqa1wrHnbVlKgLFieJsmsY1yU=' 
WHERE 
  key_id = '57c32e96e8491600641807a6de40c6c0c8413d60143c3c212e44a82893d0f0b7' 
  AND (
    token = 'wKC6AEs5zFcgjjKl+ohqa1wrHnbVlKgLFieJsmsY1yU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032