UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G5D8OiewFOr2qOPmcC3gRke8m+FDvZAHn4snx0ITF/o=' 
WHERE 
  key_id = '22fe7691bb0fa52bc552fbe8500af0f0962ee3ce1c91b911a7ef4c8d52d39576' 
  AND (
    token = 'G5D8OiewFOr2qOPmcC3gRke8m+FDvZAHn4snx0ITF/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052