UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1j4y6SdgHzEsAiqaA3qZ0GPP/ryqZu5T5NXhGXZHoDM=' 
WHERE 
  key_id = '7dd783e67601e714e14d96931196997e86e7d824ac68321515c7c7669cd936f6' 
  AND (
    token = '1j4y6SdgHzEsAiqaA3qZ0GPP/ryqZu5T5NXhGXZHoDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059