UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MEQ66TyKXqV/e9DKfGq2xbeqWneczhzPjeG8dNndquU=' 
WHERE 
  key_id = '2f3021872e67cfa594d907a213203b0db0b712737771f26bf8c88584e980402b' 
  AND (
    token = 'MEQ66TyKXqV/e9DKfGq2xbeqWneczhzPjeG8dNndquU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046