UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qSZat1agOeZiH1v5UDldeGMpnltpyuCeOP9yEvYHMNQ=' 
WHERE 
  key_id = '37cfaec7ef73cf02aea03bde24a967f1c0e3ba1bd5f1cb89bb1bd65bc2314d6f' 
  AND (
    token = 'qSZat1agOeZiH1v5UDldeGMpnltpyuCeOP9yEvYHMNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046