UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bc6NbOVHjaG/0P9jo9YU3J48Ps/tKpwWEQqLUBPqNUc=' 
WHERE 
  key_id = '1f0663526513294eb43fd1633f79f2eae4851669cfc354385b7a4171a2ba36e7' 
  AND (
    token = 'Bc6NbOVHjaG/0P9jo9YU3J48Ps/tKpwWEQqLUBPqNUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028