UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zX4n4+aS4/tx17iWxXYvBwwSTbM1+9fYs0QEup9yKLM=' 
WHERE 
  key_id = '54b92961aebc37672228b57e42802d672777cc1f34748d5e602894dc63e04a46' 
  AND (
    token = 'zX4n4+aS4/tx17iWxXYvBwwSTbM1+9fYs0QEup9yKLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048