UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zA166+uSuodufKQLiQhFUICsSYS+YD+/sA8KB2qqOzE=' 
WHERE 
  key_id = '04b327fa5531718d02906ee159a5c4659540b12e5767d5328bc11789848aed1f' 
  AND (
    token = 'zA166+uSuodufKQLiQhFUICsSYS+YD+/sA8KB2qqOzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045