UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wws+enEtQnDUt4XaibdMyv23aGTz7VYohGl3l+Xa6R0=' 
WHERE 
  key_id = '7bef1099d0126faa61d3595eb54e77458e65f3816377a02c622b965ebab17a0f' 
  AND (
    token = 'Wws+enEtQnDUt4XaibdMyv23aGTz7VYohGl3l+Xa6R0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020