UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sdIxdNmiz4tFO/dX/PXQIDWyuSCq/4tYpVjMmzO04ds=' 
WHERE 
  key_id = '4cf15164b7359b6ea101d0b41e60936ee6ca8eed9bf20a37fb46e6887d966d9b' 
  AND (
    token = 'sdIxdNmiz4tFO/dX/PXQIDWyuSCq/4tYpVjMmzO04ds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034