UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z+aBBp3vR0bjuvAJTBwLlMNeTwmlTg3EZnXL+3fdBjM=' 
WHERE 
  key_id = 'b0d8338eb97421a54f71bc0022a54d0cbb9ff6b84333e7f613bf5c7e0697865d' 
  AND (
    token = 'Z+aBBp3vR0bjuvAJTBwLlMNeTwmlTg3EZnXL+3fdBjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037