UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TSUF4dwWZQrwfZwH4yuXUt8bAa9XAwOETgjwk6HAK/Y=' 
WHERE 
  key_id = '16f6386c9cac22ddbee32efc74994520ecac07e05900d0684cd704a4acceac63' 
  AND (
    token = 'TSUF4dwWZQrwfZwH4yuXUt8bAa9XAwOETgjwk6HAK/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029