UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X0EEaSl7qrD2xq5XLcqKvzy8SUuEDEyp76nI0ah/1dA=' 
WHERE 
  key_id = '5e5878369abbf1857489465ec9855c76daa11d498fbf2022f1f905f678e6a895' 
  AND (
    token = 'X0EEaSl7qrD2xq5XLcqKvzy8SUuEDEyp76nI0ah/1dA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033